package com.eightsevensix;

import common.ListNode;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ListNode node1 = new ListNode(1);
        ListNode node2 = new ListNode(2);
        ListNode node3 = new ListNode(3);
        ListNode node4 = new ListNode(4);
        ListNode node5 = new ListNode(5);
        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        ListNode middleNode = new EightSevenSix().middleNode(node1);

        final ArrayList<Object> list = new ArrayList<>();
        while (middleNode != null) {
            System.out.println(middleNode.val);
            list.add(middleNode.val);
            System.out.println(list);
            middleNode = middleNode.next;
        }
    }
}
